﻿CREATE PROCEDURE Select_ForeignKeyTable_By_Conditions
	@Conditions NVarChar(800)=null
AS
DECLARE @N NVarChar(2000);
SET @N=N'SELECT
	[ForeignKeyTable].[CompositeKey1],
	[ForeignKeyTable].[CompositeKey2],
	[ForeignKeyTable].[CompositeKey3],
	[ForeignKeyTable].[PrimaryKeyId],
	[ForeignKeyTable].[TableId],
	[ForeignKeyTable].[GuidField],
	[ForeignKeyTable].[Field1],
	[ForeignKeyTable].[Field2]
	FROM [ForeignKeyTable] '+ @Conditions;
EXECUTE sp_executesql @N


